<script>
export default {
  name: 'PreviewImage',
  data () {
    return {
      imageList: [],
      showDialog: false,
      baseUrl: process.env.VUE_APP_BASE_PATH
    }
  },
  methods: {
    setImageList (imageList) {
      this.imageList = []
      this.showDialog = true
      if (Array.isArray(imageList)) {
        this.imageList = [...imageList]
      } else {
        this.imageList.push(imageList)
      }
    }
  }
}
</script>

<template>
  <el-dialog append-to-body title="图片详情" :visible.sync="showDialog" v-if="showDialog">
      <el-carousel height="500px" trigger="click">
        <el-carousel-item v-for="item in imageList" :key="item">
          <a :href="baseUrl+item" style="display: block" title="点击查看原图" target="_blank">
            <el-image :src="baseUrl+item" alt="" style="display:block;width: 100%;height: auto;"></el-image>
          </a>
        </el-carousel-item>
      </el-carousel>
  </el-dialog>
</template>

<style scoped lang="scss">

</style>
